package com.wxw.BaseLibrary.drawable;

import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.ShapeDrawable;

/**
 * Created by david on 2014-06-05.
 */
public class PanelStyle{
    public static GradientDrawable createSkyBluePanelStyle(){
        return createPanelStyle(GradientDrawable.Orientation.TOP_BOTTOM, new int[]{Color.parseColor("#aff5ff"), Color.parseColor("#7febff")}, 1, Color.parseColor("#505050"), 5);
    }

    public static GradientDrawable createWhitePanelStyle(){
        return createPanelStyle(GradientDrawable.Orientation.TOP_BOTTOM, new int[]{Color.parseColor("#fffffdf8"), Color.parseColor("#ffe3e3e3")}, 1, Color.parseColor("#505050"), 5);
    }

    public static GradientDrawable createYellowPanelstyle(){
        int[] colors = new int[]{Color.parseColor("#ffcb05"), Color.parseColor("#ffffe60f")};
        return createPanelStyle(GradientDrawable.Orientation.TOP_BOTTOM, colors, 1, Color.parseColor("#505050"), 5);
    }

    public static GradientDrawable createPanelStyle(GradientDrawable.Orientation orientation, int[] colors, int strokeWidth, int strokeColor, int radius){
        GradientDrawable panelStyle = new GradientDrawable();
        if (orientation!=null) {
            panelStyle.setOrientation(orientation);
        }
        if (colors.length>1) {
            panelStyle.setColors(colors);
        }
        if (colors.length==1) {
            panelStyle.setColor(colors[0]);
        }
        panelStyle.setStroke(strokeWidth, strokeColor);
        if (radius>0) {
            panelStyle.setCornerRadius(radius);
        }
        return panelStyle;
    }
}
